package cn.manjuu.touhou.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class ToHoDBOpenHelper extends SQLiteOpenHelper {

	private static ToHoDBOpenHelper mInstance;
	private static final String name = "touhou_toy_machine.db";

	public static ToHoDBOpenHelper getInstance(Context context) {
		if (null == mInstance) {
			mInstance = new ToHoDBOpenHelper(context, name, null, 1);
		}
		return mInstance;
	}

	public ToHoDBOpenHelper(Context context, String name,
			CursorFactory factory, int version) {
		super(context, name, null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL("CREATE TABLE base_info("
				+ "_id integer primary key autoincrement"
				+ ", nick_name VARCHAR(20)" + ", money VARCHAR(20))");
		db.execSQL("CREATE TABLE card_info("
				+ "_id integer primary key autoincrement" + ", player_id INTEGER, card_id integer"
				+ ", count integer" + ", card_file_name VARCHAR(20))");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub

	}

}
